#pragma once
#include "windows.h"
/**
Draw the picture to the screen.
*/
class Drawer
{
public:
	/**
	Constructor.
	*/
	Drawer(void);
	/**
	Constructor.
	@param hdc The handle of the device context.
	*/
	Drawer(HDC hdc);
	~Drawer(void);

	/**
	Set the handle of the device context.
	*/
	void SetHdc(HDC hdc);

	/**
	Draw a bitmap on the screen.
	Remark:
	This method can stretch the bitmap to fill the full rect which is specified by the param lpRect.
	Some times maybe you will not want to stretch some part of the bitmap,such as the border of the bitmap,
	You can set the part you will not want to be stretched by the param nTopNotStretch,nBottomNotStretch,nLeftHNotStretch,nRightNotStretch.
	You can only set the border part.
	@param	hBitmap				The handle of the bitmap.
	@param	lpRect				The rect which will be filled by the bitmap.
	@param	nTopNotStretch		The height of the top part not be stretched.
	@param	nBottomNotStretch	The height of the bottom part not be stretched.
	@param	nLeftHNotStretch	The width of the left part not be stretched.
	@param	nRightNotStretch	The width of the right part not be stretched.
	@return Success return TRUE,or return FALSE.
	*/
	BOOL DrawBitmap(
		HBITMAP		hBitmap, 
		LPRECT		lpRect, 
		int			nTopNotStretch = 0, 
		int			nBottomNotStretch = 0, 
		int			nLeftHNotStretch = 0,
		int			nRightNotStretch = 0
		);

	/**
	Draw the specified rect of the bitmap on the specified rect of the device context.
	@param	hBitmap		The handle of the bitmap.
	@param	lprcDc		The	rect of the device context will be drawed.
	@param	lprcBitmap	The rect of the device context will be drawed to the device context.
	@return Success return TRUE,or return FALSE.
	*/
	inline BOOL DrawBitmap(
		HBITMAP		hBitmap,
		LPRECT		lprcDc,
		LPRECT		lprcBitmap
		);
	
private:
	HDC m_hdc;	//The handle of  the device context which is used for drawing.
};
